<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>VPS测试</title>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="application/javascript" src="public/js/jquery-1.7.2.min.js"></script>
</head>
<body>
<script language="javascript">
    $(function () {
        $('#init').on('click', function () {
            var ip = $('#ip').val();
            if (ip == '') {
                alert('请填写IP');
                return;
            }

            var param = {
                ip : ip
            };

            $.ajax({
                type:'POST',
                url:'web.do?fn=vpsTestInit',
                data:{p:JSON.stringify(param)},
                success : function (res) {
                    alert(res);
                    console.log(res);
                },
                error : function (res) {
                    console.log(res);
                    alert(res.responseText);
                }
            });
        });

        $('#start').on('click', function () {
            var ip = $('#ip').val();
            if (ip == '') {
                alert('请填写IP');
                return;
            }

            var param = {
                ip : ip
            };

            $.ajax({
                type:'POST',
                url:'web.do?fn=vpsTestRestart',
                data:{p:JSON.stringify(param)},
                success : function (res) {
                    alert(res);
                    console.log(res);
                },
                error : function (res) {
                    console.log(res);
                    alert(res.responseText);
                }
            });
        });


        $('#stop').on('click', function () {
            var ip = $('#ip').val();
            if (ip == '') {
                alert('请填写IP');
                return;
            }

            var param = {
                ip : ip
            };

            $.ajax({
                type:'POST',
                url:'web.do?fn=vpsTestStop',
                data:{p:JSON.stringify(param)},
                success : function (res) {
                    alert(res);
                    console.log(res);
                },
                error : function (res) {
                    console.log(res);
                    alert(res.responseText);
                }
            });
        });

        $('#setpass').on('click', function () {
            var ip = $('#ip').val();
            if (ip == '') {
                alert('请填写IP');
                return;
            }

            var pass = $('#pass').val();
            if (pass == '') {
                alert('请填写密码');
                return;
            }

            var param = {
                ip : ip,
                pass : pass
            };

            $.ajax({
                type:'POST',
                url:'web.do?fn=vpsTestResetPass',
                data:{p:JSON.stringify(param)},
                success : function (res) {
                    alert(res);
                    console.log(res);
                },
                error : function (res) {
                    console.log(res);
                    alert(res.responseText);
                }
            });
        });
    });
</script>
<table>
    <tr>
        <td>IP：<input type="text" id="ip" style="width: 150px"></td>
    </tr>
    <tr>
        <td>
            <input type="button" value="初始化" id="init" />
            <input type="button" value="重启" id="start" />
            <input type="button" value="停止" id="stop" />
        </td>
    </tr>
    <tr>
        <td>
            密码：<input type="text" id="pass" style="width: 100px" />
            <input type="button" value="修改密码" id="setpass" />
        </td>
    </tr>
</table>
</body>
</html>